package MyTest;

public class T1 {
    public static int total_num(int num){
        int res = 0;
        while (num > 0){
            res += num % 10;
            num /= 10;
        }
        return res;
    }

    public static int get_a(int b){
        for(int i=0; i<=b; i++){
            if(total_num(i) + i == b){
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        int b = 129;
        System.out.println(total_num(129));
        System.out.println(get_a(b));
    }
}
